package com.loveprogrammer.model.goods;

import com.loveprogrammer.engine.enums.QualityEnum;
import lombok.Data;

import java.io.Serializable;
import java.util.*;

/**
 * @version 1.0.0
 * @description:
 * @author: eric
 * @date: 2024-02-23 18:27
 **/
@Data
public abstract class Goods implements Serializable {

    private String id;

    private Integer goods_id = 0;

    private String name;

    private String type;

    private int level;

    private String desc;

    public  String string ="\t\t\t\t\t\t\t\t\t";

    // 品质
    public QualityEnum quality;

    // 毒抗
    private int poisonResistance;

    // 火抗
    private int flameResistance;

    // 电抗
    private int thunderResistance;

    // 冰抗
    private int iceResistance;

    public Goods(){

    }

    // 没有等级的物品
    public Goods(String name, String type, String desc, QualityEnum quality, int goodsId) {
        this.name = name;
        this.type = type;
        this.desc = desc;
        this.quality = quality;
        this.goods_id = goodsId;
        this.id = UUID.randomUUID().toString().replace("-","");
    }

    // 有等级的物品
    public Goods(String name, String type, String desc, QualityEnum quality, int level,
                 int poisonResistance, int flameResistance, int thunderResistance, int iceResistance,
                 int goodsId) {
        this(name,type,desc,quality,goodsId);
        this.level = level;
        this.poisonResistance = poisonResistance;
        this.flameResistance = flameResistance;
        this.thunderResistance = thunderResistance;
        this.iceResistance = iceResistance;
    }

    // 物品打印信息的重写
    public String toString() {
        return  string+"****物品信息****\n"+
                string+"名称："+this.name+"\n"+
                string+"类型："+this.type +"\n"+
                string+"说明："+this.desc +"\n"+
                string+""+"***************";
    }

    // 物品打印信息的重写
    public String prettyPrint() {
        return  string+"****物品信息****\n"+
                string+"名称："+ this.name+"\n"+
                string+"品质："+ this.quality.getDesc() +"\n"+
                string+"说明："+ this.desc +"\n"+
                string+""+"***************";
    }
}
